﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Web;
using System.Windows.Media.Imaging;

namespace I9DocumentViewer.Helpers
{
    public static class ImageHelpers
    {
        public static int GetI9ImageCount(string imageName)
        {
            Stream imageStreamSource = new FileStream(System.Web.Configuration.WebConfigurationManager.AppSettings["I9Directory"] + "\\" + imageName, FileMode.Open, FileAccess.Read, FileShare.Read);
            TiffBitmapDecoder decoder = new TiffBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);

            return decoder.Frames.Count;
        }
    }
}